package com.gxuwz.service;

import com.gxuwz.mapper.InstructorMapper;
import com.gxuwz.model.entity.Instructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InstService {

    @Autowired
    private InstructorMapper instructorMapper;

    // 查询所有辅导员信息
    public List<Instructor> getAllInstructors() {
        return instructorMapper.getAllInstructor();
    }

    // 根据 instId 查询辅导员信息
    public Instructor getInstructorByInstId(String instID) {
        return instructorMapper.selectInstByInstId(instID);
    }
    public Instructor getInstructorByInstName(String instName) {
        return instructorMapper.selectInstByInstName(instName);
    }

    // 添加辅导员信息
    public boolean addInstructor(Instructor instructor) {
        return instructorMapper.insertInstructor(instructor) > 0;
    }

    // 更新辅导员信息
    public boolean updateInstructor(Instructor instructor) {
        return instructorMapper.updateInstructor(instructor) > 0;
    }

    // 删除辅导员信息
    public boolean deleteInstructorByInstId(String instID) {
        return instructorMapper.deleteInstructorByInstId(instID) > 0;
    }

}
